package com.cssl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cssl.dao.BookinformationDao;
import com.cssl.pojo.Bookinformation;
import com.cssl.service.BookinformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BookinformationServiceImpl extends ServiceImpl<BookinformationDao, Bookinformation>
    implements BookinformationService {

    @Autowired
    private BookinformationDao bdao;

    @Override
    public boolean is(String Callnumber) {
        Bookinformation bf= bdao.selectOne(new QueryWrapper<Bookinformation>().eq("Callnumber",Callnumber));
        if(bf==null){
            return  false;
        }else {
            return  true;
        }
    }

    @Override
    public int addbook(Bookinformation bf) {
        return bdao.insert(bf);
    }

    @Override
    public int updbook(Bookinformation bf) {
        return bdao.update(bf,new QueryWrapper<Bookinformation>().eq("Callnumber",bf.getCallnumber()));
    }
    @Override
    public Bookinformation bookselectbyid(Integer id){
        return bdao.selectById(id);
    }
}
